package com.xudm.cdg.config;

import com.xudm.cdg.interceptor.LoginHandlerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//@Configuration
@Slf4j
public class WebMvcConfig implements WebMvcConfigurer {
    private final LoginHandlerInterceptor loginHandlerInterceptor;

    public WebMvcConfig(LoginHandlerInterceptor loginHandlerInterceptor) {
        this.loginHandlerInterceptor = loginHandlerInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginHandlerInterceptor).excludePathPatterns("/static/**", "/error")
                .addPathPatterns("/**");
    }
}
